import React, { Component } from 'react'
import './index.less'
import { withRouter } from 'react-router-dom'

class Goback extends Component {
  gobackFn() {
    console.log(this.props);
    this.props.history.go(-1)
    //打包后可能会发现 history.goBack() 会造成上一级路由参数丢失
    // this.props.history.goBack()
    
  }
  render() {
    return (
      <div className="goback" onClick={this.gobackFn.bind(this)}>返回上一层</div>
    )
  }
}
export default withRouter(Goback)
